package com.qdaily.ui.net.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Felix
 * Date: 3/30/15
 * Time: 16:42
 * QQ:74104
 * Email:lovejiuwei@gmail.com
 */
public class ArticleFeedPost implements Parcelable {
    private int id = 0;
    private int genre = 0;
    private String title = "";
    private int publish_time = 0;
    private int comment_count = 0;
    private int praise_count = 0;
    private String super_tag = "";
    private int page_style = 0;
    private int record_count = 0;
    private String image = "";
    private String description = "";
    private String appview = "";
    private ArticleMetaCategory category = new ArticleMetaCategory();
    private List<ArticleMetaTag> tag = new ArrayList<ArticleMetaTag>();

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getGenre() {
        return genre;
    }

    public void setGenre(int genre) {
        this.genre = genre;
    }

    public int getPublish_time() {
        return publish_time;
    }

    public void setPublish_time(int publish_time) {
        this.publish_time = publish_time;
    }

    public int getComment_count() {
        return comment_count;
    }

    public void setComment_count(int comment_count) {
        this.comment_count = comment_count;
    }

    public int getPraise_count() {
        return praise_count;
    }

    public void setPraise_count(int praise_count) {
        this.praise_count = praise_count;
    }

    public String getSuper_tag() {
        return super_tag;
    }

    public void setSuper_tag(String super_tag) {
        this.super_tag = super_tag;
    }

    public int getPage_style() {
        return page_style;
    }

    public void setPage_style(int page_style) {
        this.page_style = page_style;
    }

    public int getRecord_count() {
        return record_count;
    }

    public void setRecord_count(int record_count) {
        this.record_count = record_count;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getAppview() {
        return appview;
    }

    public void setAppview(String appview) {
        this.appview = appview;
    }

    public ArticleMetaCategory getCategory() {
        return category;
    }

    public void setCategory(ArticleMetaCategory category) {
        this.category = category;
    }

    public List<ArticleMetaTag> getTag() {
        return tag;
    }

    public void setTag(List<ArticleMetaTag> tag) {
        this.tag = tag;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.id);
        dest.writeInt(this.genre);
        dest.writeString(this.title);
        dest.writeInt(this.publish_time);
        dest.writeInt(this.comment_count);
        dest.writeInt(this.praise_count);
        dest.writeString(this.super_tag);
        dest.writeInt(this.page_style);
        dest.writeInt(this.record_count);
        dest.writeString(this.image);
        dest.writeString(this.description);
        dest.writeString(this.appview);
        dest.writeParcelable(this.category, 0);
        dest.writeTypedList(tag);
    }

    public ArticleFeedPost() {
    }

    private ArticleFeedPost(Parcel in) {
        this.id = in.readInt();
        this.genre = in.readInt();
        this.title = in.readString();
        this.publish_time = in.readInt();
        this.comment_count = in.readInt();
        this.praise_count = in.readInt();
        this.super_tag = in.readString();
        this.page_style = in.readInt();
        this.record_count = in.readInt();
        this.image = in.readString();
        this.description = in.readString();
        this.appview = in.readString();
        this.category = in.readParcelable(ArticleMetaCategory.class.getClassLoader());
        in.readTypedList(tag, ArticleMetaTag.CREATOR);
    }

    public static final Creator<ArticleFeedPost> CREATOR = new Creator<ArticleFeedPost>() {
        public ArticleFeedPost createFromParcel(Parcel source) {
            return new ArticleFeedPost(source);
        }

        public ArticleFeedPost[] newArray(int size) {
            return new ArticleFeedPost[size];
        }
    };

    @Override
    public String toString() {
        return "ArticleFeedPost{" +
                "image='" + image + '\'' +
                ", id=" + id +
                ", genre=" + genre +
                ", title='" + title + '\'' +
                ", publish_time=" + publish_time +
                ", comment_count=" + comment_count +
                ", praise_count=" + praise_count +
                ", super_tag='" + super_tag + '\'' +
                ", page_style=" + page_style +
                ", record_count=" + record_count +
                ", description='" + description + '\'' +
                ", appview='" + appview + '\'' +
                ", category=" + category +
                ", tag=" + tag +
                '}';
    }
}
